<?php session_start(); 
if(!isset($_SESSION["login"]) || $_SESSION["login"] == 0)
{
	
$_SESSION["hisURL"] = curPageURL();
 header("Location: login.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/templateadmin.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Place your description here" />
<meta name="keywords" content="put, your, keyword, here" />
<meta name="author" content="Templates.com - website templates provider" />
<link href="css/styleAdmin.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Administrator - Up Game</title>
<link href="../css/lightbox.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery.min.js" language="javascript"></script>
<script src="../js/ajax_framework.js" language="javascript"></script>
<script src="../js/lightbox.js" language="javascript"></script>



<script>

jQuery(document).ready(function($) {
    $("#m3").attr("class","active");
	$("#loadingpage").fadeOut(1000);

});
</script>
<script type="text/javascript">
function callAjaxAddition() {
if(document.formUpload.txtLinkGame.value == '' || document.formUpload.txtLinkGame.value.search('http://itunes.apple.com/') == -1)
		{
			alert('Hãy điền link game!');
			document.formUpload.txtLinkGame.focus();
			return false;
		}
	showLoadingPage();
	document.getElementById('insert_response').innerHTML ='';
	document.getElementById('review').innerHTML ='';
	document.formUpload.txtTenGame.value = '';
  arguments0 = {
     arg1: $("#formUpload input[name='txtLinkGame']").val()
  };
  $.ajax({
     type: "POST",
     url: "process/processAjax.php",
     data: {arguments: arguments0},
     success: function(data) {
       $("#review").html(data);   
	 	$("#loadingpage").fadeOut(1000);
		
    }
  });
  return false;
}
</script>
<script type="text/javascript">
function Checker()
{
	var oRed = '#ff0000'
	var oWhite = '#ffffff'
	if(document.formUpload.txtTenGame.value == '')
	{
		alert('Hãy điền tên game!');
		document.formUpload.txtTenGame.focus();
		document.getElementById('txtTenGame').style.backgroundColor = oRed;
		return false;
	}
	else
	{
		document.getElementById('txtTenGame').style.backgroundColor = oWhite;
		if(document.formUpload.txtLinkGame.value == '' || document.formUpload.txtLinkGame.value.search('http://itunes.apple.com/') == -1)
		{
			alert('Hãy điền link game!');
			document.formUpload.txtLinkGame.focus();
			document.getElementById('txtLinkGame').style.backgroundColor = oRed;
			return false;
		}
		else
		{
			document.getElementById('txtLinkGame').style.backgroundColor = oWhite;
			if(document.formUpload.txtPrice.value == '')
			{
				alert('Hãy điền giá!');
				document.formUpload.txtPrice.focus();
				document.getElementById('txtPrice').style.backgroundColor = oRed;
				return false;
			}
			else
			{
			if(isNaN(document.formUpload.txtPrice.value))
			{
				alert('Giá phải là số!');
				document.formUpload.txtPrice.focus();
				document.getElementById('txtPrice').style.backgroundColor = oRed;
				return false;
			}
			else
			{document.getElementById('txtPrice').style.backgroundColor = oWhite;
			if(document.formUpload.cbxType.value == 0)
			{
				alert('Hãy chọn thể loại!');
				document.formUpload.cbxType.focus();
				document.getElementById('cbxType').style.backgroundColor = oRed;
				return false;
				}
			}}
			
				
		}
	}
	document.getElementById('cbxType').style.backgroundColor = oWhite
	return true;
}

</script>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<script src="../js/jquery.min.js" language="javascript"></script>
<script type="text/javascript">
$(document).ready(function() {

    $("ul#topnav li").hover(function() { //sự kiện khi đưa chuột vào menu
        //Add background color and image on hovered list item
        $(this).find("span").show(); //hiễn thị menu cấp 2
    } , function() { //on hover out...
        $(this).css({ 'background' : 'none'}); 
        $(this).find("span").hide(); //ẩn menu cấp 2
    });

});
</script>  
<script>
function checkgo()
{
	if(isNaN(document.gopage.go.value))
	return false;
}

</script>
<?php
function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
 ?>
</head>

<body id="page1">
<div id="loadingpage" style="		
	text-align:center;
	position:fixed;
  z-index: 100;  
  top:49%; 
  left:49%;
  background-color:#A0A0A4;
  opacity:0.7;
  display:none;
  " >
<img src="../img/loadingpage.gif" width="55px" height="55px"  />
</div>

<div class="tail-top">
	<div class="tail-bottom">
		<div class="body-bg">
			<!-- HEADER -->
			<div id="header">
				<div class="extra"><img src="images/header-img.png" alt="" /></div>
				<div class="row-1">
					
					<div class="fright">
                    <?php
                    	if(isset($_SESSION["login"]) && $_SESSION["login"] == 1)
                        {
                            echo ' <span>Hi! '.$_SESSION["user"]. '. <a href="process/processLogin.php" style="text-decoration:none;" >log out</a></span>';
                       
                        }
                        
                        
                        ?>
                    </div>
				</div>
				<div class="row-2">
					<ul id="topnav">
						<li class="m1"><a id="m1" href="home.php">Game Manager</a></li>
						<li class="m2"><a id="m2" href="categories.php">Categories Manager</a></li>
						<li class="m3" style="height:110px;" ><a id="m3" href="upgame.php">Upload Game</a><span style="display:none;"><a style="background:none; padding:0;"   href="customupgame.php">Custom Game</a></span></li>
						<li class="m4"><a id="m4" href="bills.php">Bills Manager</a></li>
						<li class="m5"><a id="m5" href="banner.php">Banner Manager</a></li>
                        <li class="m6" ><a id="m6" href="request.php">Request Manager</a></li>
						<li class="m7" style="display:none;"><a id="m6" href="sitemap.html">Sitemap</a></li>
					</ul>
				</div>
				
			</div>
			<!-- CONTENT -->
			<div id="content">
				<div class="tail-right">
					<div class="wrapper">
						<div class="col-1"><!-- InstanceBeginEditable name="col1" -->
<form id="formUpload" name="formUpload" method="post" action="javascript:insert()" >
<table width="100%" border="0" align="center" style="margin-top:10px;">
    <tr>
        <td align="right" width="45%" ><span class="text3"><a>Tên game:</a></span></td>
        <td colspan="2">
        <input type="text" name="txtTenGame" id="txtTenGame" onchange=""/>
        </td>
    </tr>
        <tr>
        <td align="right"><span class="text3"><a>Link game:</a></span></td>
        <td colspan="2">
        <input type="text" name="txtLinkGame" id="txtLinkGame" />
        </td>
    </tr>
    <tr>
        <td align="right"><span class="text3"><a>Giá:</a></span></td>
        <td colspan="2">
        <input type="text" name="txtPrice" id="txtPrice" />
        </td>
    </tr>
    <tr>
        <td align="right"><span class="text3"><a>Thể loại:</a></span></td>
        <td colspan="2">
        <select name="menu" id="cbxType" style="width:auto;">
            <option value="0" selected>[Chọn thể loại]</option>
            <?php
			include_once("../DataProvider.php");
			$sql = "select * from tbl_categories";
			$result = DataProvider::ExecuteQuery($sql);
			while($row = mysql_fetch_array($result))
			{
				echo'<option value="'.$row["idCategories"].'">'.$row["categories"].'</option>';
			}
			?>
        </select>
        </td>
    </tr>
    <tr>
        <td align="right"><span class="text3"><a>Device:</a></span></td>
        <td colspan="2">
        <select name="cbxDevice" id="cbxDevice" style="width:auto;">
            <option value="1" selected>IPhone</option>
            <option value="2" >IPad</option>
            <option value="3">IPhone&IPad</option>
        </select>
        </td>
    </tr>
        <tr>
        <td align="right"><span class="text3"><a>Game hot:</a></span></td>
        <td colspan="2">
        <input type="checkbox" name="chkHot" id="chkHot" />
        </td>
    </tr>
<tr style="margin-top:30px; height:50px ">
<td align="center" colspan="3">
<input type="submit" name="btnUp" value="Upload" onclick="return Checker()" />

<input type="reset" name="btnLamLai" value="Làm lại" />

<input type="button" name="btnView" value="Xem" onclick="callAjaxAddition()"/>
</td>
</tr>
<tr>
<td>&nbsp;

</td>
</tr>
<tr><td colspan="3" align="center"><div id="insert_response"></div>
<div id="review" align="center">

&nbsp;
</div></td></tr>
</table>
</form>
<div id="msg" style="		
	text-align:center;
	position:fixed;
  z-index: 100;  
  top:49%; 
  left:49%;
  background-color:#2A3F00;
  border:1px #808080 solid;
  border-radius: 4px 4px 4px 4px;
  height:30px;
  width:100px;
  display:none;
  " >

</div>
<!-- InstanceEndEditable -->
							
				      </div>
					</div>
				</div>
			</div>
			<!-- FOOTER -->
			<div id="footer">
				<div class="indent">
					<div class="fleft">
<div class="vlinks"><a href="http://www.webdesign.org">Web design</a> by <a title="Free Templates Online" href="http://www.freetemplatesonline.com">Free Templates</a> Online</div></div>
					<div class="fright">Copyright - HTT</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript"> 
showLoadingPage();
function showLoadingPage()
{
	$("#loadingpage").show();
} 
Cufon.now(); </script>
</body>
<!-- InstanceEnd --></html>
